#include <iostream>
#include <vector>

using namespace std;

int main() {
    vector<int> a {1};
    vector<int> b {1};
    vector<int> c {};
    int r = 2;
    int d = 1000;
    while (true) {
        c.clear();
        int carry = 0;
        for (int i = 0; i < a.size(); i++) {
            int sum = a[i] + b[i] + carry;
            c.push_back(sum % 10);
            carry = sum / 10;
        }
        for (int i = a.size(); i < b.size(); i++) {
            int sum = b[i] + carry;
            c.push_back(sum % 10);
            carry = sum / 10;
        }
        if (carry) {
            c.push_back(carry);
        }
        ++r;
        if (c.size() >= d) {
            break;
        }
        // for (auto &x : c) {
        //    cout << x;
        // }
        // cout << endl;
        swap(a, b);
        swap(b, c);
    }
    cout << r << endl; // 4782
}